<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 100px;
        height: 100px;
        background-color: red;
      }

      .box2 {
        background-color: pink;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <!-- ✔️动态class -->
      <!-- 语法: :class="{css类名 : 布尔值}" -->
      <!-- 作用: 当布尔值为true时, 该元素会自动添加css类名, 当为false时, 会自动移除类名 -->
      <div class="box" :class="{box2: isPink}" @click="isPink  = !isPink">
        点我
      </div>

      <!-- ❌动态style -->
      <div :style="{backgroundColor: color}">456</div>
    </div>

    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          isPink: false,
          color: "pink",
        },
        methods: {},
      });
    </script>
  </body>
</html>
